const MySymbol = ((x) => {
    let cache = new Map();

    function fn() {
        // 判断不能new
        if (this instanceof fn) {
            throw new Error('wri')
        }
        cache.set(x, {})
        return {}
    }
    fn.for = function (key) {
        if (cache.has(key)) {
            return cache.get(key)
        }
        return {}
    }

    fn.keyfor = function (val) {
        for (const [k, v] of cache) {
            if (v == val) {
                return k
            }
        }
    }
    return fn

})(x)
console.log(new MySymbol("1"))
let a = symbol()





// console.log(new MySymbol())
// function fn() {
//     console.log(this)
//     if (this instanceof fn) {
//         throw new Error("error")
//     }
// }
// console.log(new fn())